package net.yters.model.agents.actuators;

import java.util.ArrayList;

import net.yters.model.agents.concrete.BulletAgent;
import net.yters.util.Util;

public class ShootActuator extends ActuatorAgent {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -8541748259555084421L;

	public ShootActuator() {
		super();
	}
	
	@Override
	public void execute() {
        ArrayList<Double> newPos = new ArrayList<Double>();
        newPos = Util.add(
        		net.yters.util.Util.disemBoxArray(f_ownerAgent.f_position), 
        		net.yters.util.Util.disemBoxArray(f_ownerAgent.f_direction));

        if(f_ownerAgent.f_model.f_env.getContent(newPos) == 0) {
			f_ownerAgent.f_model.addAgent(
        			new BulletAgent(f_ownerAgent.f_model, newPos, 
        					net.yters.util.Util.disemBoxArray(f_ownerAgent.f_direction)));
		}
    }
}